<!--
  ~ Copyright (C) 2010 Brockmann Consult GmbH (info@brockmann-consult.de)
  ~
  ~ This program is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU General Public License as published by the Free
  ~ Software Foundation; either version 3 of the License, or (at your option)
  ~ any later version.
  ~ This program is distributed in the hope that it will be useful, but WITHOUT
  ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  ~ more details.
  ~
  ~ You should have received a copy of the GNU General Public License along
  ~ with this program; if not, see http://www.gnu.org/licenses/
  -->

<html>

<head>
    <title>Sentinel Toolbox - Mosaic Algorithm</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="../style.css">
</head>

<body>

<table class="header">
    <tr class="header">
        <td class="header">&nbsp;
            Mosaic Algorithm</td>
        <td class="header" align="right"><a href="../general/overview/SnapOverview.html"><img src="../images/snap_header.jpg" border=0></a>
        </td>
    </tr>
</table>

<h3><a name="DF"></a>Data Flow</h3>

<p>The following sketch shows the simple data flow within the Mosaic Processor:</p>

<p><img src="images/MosaicFlow.png"></p>

<p>In a first step the output product is created using the supplied reprojection information and output parameters
    such as pixel size and easting and northing. Once an output product has been written it can be
    updated with an unlimited number of new input products.</p>

<h3><a name="POM"></a>Principle of Mosaicking </h3>

<p>The &quot;filling&quot; of the level 3 product follows the principle of fetching pixels from source products instead
    of putting all source product pixels into the target bins. The Mosaic Processor loops over all cells in the target
    grid and determines whether a pixel from a source product may be suitable to read into it. This is done by looking
    up
    the nearest neighbour pixel in the input product that contains the geographical center coordinate of the current
    output
    pixel being handled. As a reminder: the <a href="../binning/BinningTool.html">Level 3 Binning Processor</a> takes
    all input pixels
    and sorts them into bins defined by the output product. Consider the following image:</p>

<p><img src="images/MosaicBinningScheme.png"></p>

<p>The red rectangle marks the geographic boundary of the level 3 product; black lines are target grid cells. Note that
    the input products may have a raster size different from the level 3 product (white lines).</p>

<h3><a name="OV"></a>Output Variables</h3>

<p>The bands of the output products are defined by <i>output variables</i>.
    Pixel values are accumulated using the arithmetic mean of all valid input pixels of all input products
    found for a given output pixel. An output varaiable has a name and an expression comprising mathematical
    operators, functions and symbols referencing the flags and bands defined in the input products. In it simplest form,
    the
    expression is a reference to a single band, the band's name. </p>

<h3><a name="VPC"></a>Valid Pixel Criteria</h3>

<p>Whether or not a pixel value is valid and thus taken over in the output product is determined by a set
    of <i>valid pixel criteria</i>. A valid pixel criterion is a boolean expression comprising mathematical operators,
    functions and symbols referencing the flags and bands defined in the input products. The mosaic processor can take
    any number of
    valid pixel criteria which can be either AND or OR combined. If no valid pixel criterion is given, all pixels are
    assumed as being valid.</p>

<hr>

</body>
</html>
